# i = 1
# while i <= 5:
#     x = 1
#     while x <= 3:
#         print(f"第{i}天,跑了{x}圈")
#         x += 1
#     i += 1


# 练习2

x = 1
while x <= 5:
    y = 1
    while y <= 5:
        print("*", end='')
        y += 1
    print()
    x = x + 1

# for 循环 遍历容器

content = "恭喜心灵星图的作者,成为优质开发工具推荐榜14"
for i in content:  # 遇到: 按Tab 换行
    print(i)

content = "恭喜心灵星图的作者,成为优质开发工具推荐榜14"
for i in content:  # 遇到: 按Tab 换行
    if i == "1" or i == "4":
        print('1')
    else:
        print(i)

# 无限循环

# while True:
#     name = input('请输入报道学生姓名:')
#     if name == "exit":
#         exit(0)
#     print(f"今天接待的学生为{name}")

# break
for i in range(1, 10):
    if i > 6:
        break
    print(f'今天正在干饭,这是第{i}个包子')
else:
    print("如果程序没有被中断,就会执行这个")

# continue
count = 0
for i in range(1, 21, 1):
    if i == 6:
        continue
    count += 1
    print(f"我正在吃{i}个葡萄")
print(f"总共吃了{count}个葡萄")
# 报数字游戏

num = int(input("请输入班级人数"))
for i in range(1, num + 1, 1):
    if i % 10 == 7 or i % 7 == 0:
        continue
    print(f"需要报的数字为{i}")

# 字符串索引

nick_name = '天王盖地虎'
print(nick_name[0])
print(nick_name[-1])

# 切片操作,要区分索引,所以必须有:
nick_name = '张王岩,你好呀'
print(nick_name[::])
print(nick_name[:])
print(nick_name[-1:-2:-1])
print(nick_name[0:3:2])

# 字符串的查找功能 find index
nick_name = '刀枪剑戟 斧钺钩叉'
print(nick_name.find('刀'))
# print(nick_name.index('何先生'))

print("*" * 20)  # 字符串练习
str1 = "abcdefghijkl"

i = 0

while i <= str1.find(str1[-1:-2:-1]):
    print(str1[i])
    i += 2
 